<template>
  <div class="submit-btn submitBtnCheck cenCen" @click="subOrder()">
    <div>提交</div>
  </div>
</template>
<script>
import { storageCar } from "./../../../publicJs/storageCar.js";
export default {
  methods: {
    subOrder() {
      sessionStorage.setItem(
        "foldUpTicket",
        JSON.stringify(this.$store.state.buyTicket.foldUpTicket)
      ); //本地存储一下我的购物车当中参与打折的门票
      if (this.$store.state.buyTicket.carTicketSumList.length == 0) {
        this.$toast("请先购票");
        return;
      }
      //本地存储一些购物车的数据防止刷新导致数据丢失
      storageCar();
      if (
        this.$store.state.buyTicket.carTicketSumList.length >=
        this.$store.state.buyTicket.groupBuyingLimitNum
      ) {
        // 如果当前购买数量大等于团购数量则需要选择一项
        this.$store.state.buyTicket.groupBuyingAlert = true;
        return;
      }
      this.$router.push({
        name: "orderEnter"
      });
    }
  }
};
</script>
